package com.example.demo.service;

import com.example.demo.mapper.CategoryMapper;
import com.example.demo.pojo.Catrgoryicon;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanglup
 * @create 2020-12-06 15:53
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    CategoryMapper categoryMapper;


    /**查询的分类列表*/
    @Override
    public PageInfo<Catrgoryicon> Categoryicongonglist(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Catrgoryicon> mymycatrgoryicon= categoryMapper.Categoryicongonglist();
        PageInfo<Catrgoryicon> catrgoryiconPageInfo=new PageInfo<Catrgoryicon>(mymycatrgoryicon,pageSize);
        return catrgoryiconPageInfo;
    }
//    /**查询的分类列表*/
//    @Override
//    public List<Catrgoryicon> Categoryicongonglist() {
//        return categoryMapper.Categoryicongonglist();
//    }
    /**算出总数量*/
    @Override
    public Integer Catrgoryicongonglistnumber() {
        return categoryMapper.Catrgoryicongonglistnumber();
    }


    /**修改1*/
    @Override
    public Catrgoryicon Categoryicongongupdate(Integer cat_id) {
        return categoryMapper.Categoryicongongupdate(cat_id);
    }
    /**修改2*/
    @Override
    public void Categoryicongonglisttijiao(Integer cat_id, String cat_name, String cat_icon) {
        categoryMapper.Categoryicongonglisttijiao(cat_id,cat_name,cat_icon);
    }

    /**查询名字*/
    @Override
    public List<Catrgoryicon> Categoryicongonglistquery(String cat_name) {
        return categoryMapper.Categoryicongonglistquery(cat_name);
    }
    /**查询页面数量*/
    @Override
    public Integer Categoryicongonglistquerynumber(String cat_name) {
        return categoryMapper.Categoryicongonglistquerynumber(cat_name);
    }

}
